package com.peng.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.ObjectUtils;

/**
 * 用户表
 * @TableName t_user
 */
@TableName(value ="t_user")
@Data
public class TUser implements Serializable {
    public TUser() {
    }

    private static final long serialVersionUID = 1L;
    /**
     * 主键，自动增长，用户ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 登录账号
     */
    @TableField(value = "login_act")
    private String login_act;

    /**
     * 登录密码
     */
    @TableField(value = "login_pwd")
    private String login_pwd;

    /**
     * 用户姓名
     */
    @TableField(value = "name")
    private String name;

    /**
     * 用户手机
     */
    @TableField(value = "phone")
    private String phone;

    /**
     * 用户邮箱
     */
    @TableField(value = "email")
    private String email;

    /**
     * 账户是否没有过期，0已过期 1正常
     */
    @TableField(value = "account_no_expired")
    private Integer account_no_expired;

    /**
     * 密码是否没有过期，0已过期 1正常
     */
    @TableField(value = "credentials_no_expired")
    private Integer credentials_no_expired;

    /**
     * 账号是否没有锁定，0已锁定 1正常
     */
    @TableField(value = "account_no_locked")
    private Integer account_no_locked;

    /**
     * 账号是否启用，0禁用 1启用
     */
    @TableField(value = "account_enabled")
    private Integer account_enabled;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private Date create_time;

    /**
     * 创建人
     */
    @TableField(value = "create_by")
    private Integer create_by;

    /**
     * 编辑时间
     */
    @TableField(value = "edit_time")
    private Date edit_time;

    /**
     * 编辑人
     */
    @TableField(value = "edit_by")
    private Integer edit_by;

    /**
     * 最近登录时间
     */
    @TableField(value = "last_login_time")
    private Date last_login_time;

    public TUser(TUser user) {
        this.id = user.getId();
        this.login_act = user.getLogin_act();
        this.login_pwd = user.getLogin_pwd();
        this.name = user.getName();
        this.phone = user.getPhone();
        this.email = user.getEmail();
        this.account_no_expired = user.getAccount_no_expired();
        this.credentials_no_expired = user.getCredentials_no_expired();
        this.account_no_locked = user.getAccount_no_locked();
        this.account_enabled = user.getAccount_enabled();
        this.create_time = user.getCreate_time();
        this.create_by = user.getCreate_by();
        this.edit_time = user.getEdit_time();
        this.edit_by = user.getEdit_by();
        this.last_login_time = user.getLast_login_time();
    }

    public TUser(Integer id, String login_act, String login_pwd, String name, String phone, String email, Integer account_no_expired, Integer credentials_no_expired, Integer account_no_locked, Integer account_enabled, Date create_time, Integer create_by, Date edit_time, Integer edit_by, Date last_login_time) {
        this.id = id;
        this.login_act = login_act;
        this.login_pwd = login_pwd;
        this.name = name;
        this.phone = phone;
        this.email = email;
        this.account_no_expired = account_no_expired;
        this.credentials_no_expired = credentials_no_expired;
        this.account_no_locked = account_no_locked;
        this.account_enabled = account_enabled;
        this.create_time = create_time;
        this.create_by = create_by;
        this.edit_time = edit_time;
        this.edit_by = edit_by;
        this.last_login_time = last_login_time;
    }
}